package com.sinothk.service.biz.controller;

import com.sinothk.server.support.entity.ResultData;
import com.sinothk.service.biz.dto.HomeEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "鉴权操作")
@RestController
@RefreshScope //开启配置更新功能
@RequestMapping("/authorize")
public class HomeController {

//    @Value("${from}")
//    private String fromValue;

    @ApiOperation(value = "获取鉴权", notes = "获取鉴权。。")
    @GetMapping("/getInfo")
    public ResultData<HomeEntity> getInfo(@ApiParam(value = "验证Token", type = "header", required = true) @RequestHeader(value = "token") String token) {
        HomeEntity user = new HomeEntity();
        user.setUserName("1111");

        ResultData<HomeEntity> resultData = new ResultData<>();
        resultData.setData(user);
        return resultData;
    }
}